﻿using Microsoft.Extensions.Configuration;
using Oracle.ManagedDataAccess.Client;
using System.Data;
using Volo.Abp.DependencyInjection;

namespace SyncWayBill
{
    public class ConnectionService : ITransientDependency
    {
        private IConfiguration configuration;
        public ConnectionService(IConfiguration _configuration)
        {
            configuration = _configuration;
        }
        public IDbConnection GetConnection()
        {
            var connectionString = configuration.GetConnectionString("Xc_Zhwl");
            var conn = new OracleConnection(connectionString);
            return conn;
        }
        public string GetUnloading() { return configuration.GetValue<string>("Unloading"); }
        /// <summary>
        /// 推送运单
        /// </summary>
        /// <returns></returns>
        public string GetSendLoadingUrl() { return configuration.GetValue<string>("sendLoadUrl"); }
        /// <summary>
        /// 推送码单
        /// </summary>
        /// <returns></returns>

        public string GetSendMdUrl() { return configuration.GetValue<string>("sendMdUrl"); }
        /// <summary>
        /// 推送码单红冲
        /// </summary>
        /// <returns></returns>

        public string GetSendMdHcUrl() { return configuration.GetValue<string>("sendMdUrlCh"); }
    }
}
